<?php

require_once 'propel/om/BaseObject.php';

require_once 'propel/om/Persistent.php';


include_once 'propel/util/Criteria.php';

include_once 'classes/model/HrLocationsPeer.php';

/**
 * Base class that represents a row from the 'HR_LOCATIONS' table.
 *
 * 
 *
 * @package    workflow.classes.model.om
 */
abstract class BaseHrLocations extends BaseObject  implements Persistent {


	/**
	 * The Peer class.
	 * Instance provides a convenient way of calling static methods on a class
	 * that calling code may not be able to identify.
	 * @var        HrLocationsPeer
	 */
	protected static $peer;


	/**
	 * The value for the location_uid field.
	 * @var        string
	 */
	protected $location_uid = '';


	/**
	 * The value for the district_id field.
	 * @var        string
	 */
	protected $district_id = '0';


	/**
	 * The value for the locationstate_id field.
	 * @var        string
	 */
	protected $locationstate_id = '';


	/**
	 * The value for the locationname field.
	 * @var        string
	 */
	protected $locationname = '';


	/**
	 * The value for the locationaddress1 field.
	 * @var        string
	 */
	protected $locationaddress1 = '';


	/**
	 * The value for the locationaddress2 field.
	 * @var        string
	 */
	protected $locationaddress2 = '';


	/**
	 * The value for the locationsite field.
	 * @var        string
	 */
	protected $locationsite = '';


	/**
	 * The value for the locationzipcode field.
	 * @var        string
	 */
	protected $locationzipcode = '';


	/**
	 * The value for the locationphone field.
	 * @var        string
	 */
	protected $locationphone = '';


	/**
	 * The value for the locationfax field.
	 * @var        string
	 */
	protected $locationfax = '';


	/**
	 * The value for the locationcode field.
	 * @var        string
	 */
	protected $locationcode = '';


	/**
	 * The value for the locationcomments field.
	 * @var        string
	 */
	protected $locationcomments = '';


	/**
	 * The value for the irn field.
	 * @var        string
	 */
	protected $irn = '';


	/**
	 * The value for the maindistrictlocation field.
	 * @var        int
	 */
	protected $maindistrictlocation = 0;

	/**
	 * Flag to prevent endless save loop, if this object is referenced
	 * by another object which falls in this transaction.
	 * @var        boolean
	 */
	protected $alreadyInSave = false;

	/**
	 * Flag to prevent endless validation loop, if this object is referenced
	 * by another object which falls in this transaction.
	 * @var        boolean
	 */
	protected $alreadyInValidation = false;

	/**
	 * Get the [location_uid] column value.
	 * 
	 * @return     string
	 */
	public function getLocationUid()
	{

		return $this->location_uid;
	}

	/**
	 * Get the [district_id] column value.
	 * 
	 * @return     string
	 */
	public function getDistrictId()
	{

		return $this->district_id;
	}

	/**
	 * Get the [locationstate_id] column value.
	 * 
	 * @return     string
	 */
	public function getLocationstateId()
	{

		return $this->locationstate_id;
	}

	/**
	 * Get the [locationname] column value.
	 * 
	 * @return     string
	 */
	public function getLocationname()
	{

		return $this->locationname;
	}

	/**
	 * Get the [locationaddress1] column value.
	 * 
	 * @return     string
	 */
	public function getLocationaddress1()
	{

		return $this->locationaddress1;
	}

	/**
	 * Get the [locationaddress2] column value.
	 * 
	 * @return     string
	 */
	public function getLocationaddress2()
	{

		return $this->locationaddress2;
	}

	/**
	 * Get the [locationsite] column value.
	 * 
	 * @return     string
	 */
	public function getLocationsite()
	{

		return $this->locationsite;
	}

	/**
	 * Get the [locationzipcode] column value.
	 * 
	 * @return     string
	 */
	public function getLocationzipcode()
	{

		return $this->locationzipcode;
	}

	/**
	 * Get the [locationphone] column value.
	 * 
	 * @return     string
	 */
	public function getLocationphone()
	{

		return $this->locationphone;
	}

	/**
	 * Get the [locationfax] column value.
	 * 
	 * @return     string
	 */
	public function getLocationfax()
	{

		return $this->locationfax;
	}

	/**
	 * Get the [locationcode] column value.
	 * 
	 * @return     string
	 */
	public function getLocationcode()
	{

		return $this->locationcode;
	}

	/**
	 * Get the [locationcomments] column value.
	 * 
	 * @return     string
	 */
	public function getLocationcomments()
	{

		return $this->locationcomments;
	}

	/**
	 * Get the [irn] column value.
	 * 
	 * @return     string
	 */
	public function getIrn()
	{

		return $this->irn;
	}

	/**
	 * Get the [maindistrictlocation] column value.
	 * 
	 * @return     int
	 */
	public function getMaindistrictlocation()
	{

		return $this->maindistrictlocation;
	}

	/**
	 * Set the value of [location_uid] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationUid($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->location_uid !== $v || $v === '') {
			$this->location_uid = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATION_UID;
		}

	} // setLocationUid()

	/**
	 * Set the value of [district_id] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setDistrictId($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->district_id !== $v || $v === '0') {
			$this->district_id = $v;
			$this->modifiedColumns[] = HrLocationsPeer::DISTRICT_ID;
		}

	} // setDistrictId()

	/**
	 * Set the value of [locationstate_id] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationstateId($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationstate_id !== $v || $v === '') {
			$this->locationstate_id = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONSTATE_ID;
		}

	} // setLocationstateId()

	/**
	 * Set the value of [locationname] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationname($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationname !== $v || $v === '') {
			$this->locationname = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONNAME;
		}

	} // setLocationname()

	/**
	 * Set the value of [locationaddress1] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationaddress1($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationaddress1 !== $v || $v === '') {
			$this->locationaddress1 = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONADDRESS1;
		}

	} // setLocationaddress1()

	/**
	 * Set the value of [locationaddress2] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationaddress2($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationaddress2 !== $v || $v === '') {
			$this->locationaddress2 = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONADDRESS2;
		}

	} // setLocationaddress2()

	/**
	 * Set the value of [locationsite] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationsite($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationsite !== $v || $v === '') {
			$this->locationsite = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONSITE;
		}

	} // setLocationsite()

	/**
	 * Set the value of [locationzipcode] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationzipcode($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationzipcode !== $v || $v === '') {
			$this->locationzipcode = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONZIPCODE;
		}

	} // setLocationzipcode()

	/**
	 * Set the value of [locationphone] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationphone($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationphone !== $v || $v === '') {
			$this->locationphone = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONPHONE;
		}

	} // setLocationphone()

	/**
	 * Set the value of [locationfax] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationfax($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationfax !== $v || $v === '') {
			$this->locationfax = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONFAX;
		}

	} // setLocationfax()

	/**
	 * Set the value of [locationcode] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationcode($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationcode !== $v || $v === '') {
			$this->locationcode = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONCODE;
		}

	} // setLocationcode()

	/**
	 * Set the value of [locationcomments] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setLocationcomments($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->locationcomments !== $v || $v === '') {
			$this->locationcomments = $v;
			$this->modifiedColumns[] = HrLocationsPeer::LOCATIONCOMMENTS;
		}

	} // setLocationcomments()

	/**
	 * Set the value of [irn] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setIrn($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->irn !== $v || $v === '') {
			$this->irn = $v;
			$this->modifiedColumns[] = HrLocationsPeer::IRN;
		}

	} // setIrn()

	/**
	 * Set the value of [maindistrictlocation] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setMaindistrictlocation($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->maindistrictlocation !== $v || $v === 0) {
			$this->maindistrictlocation = $v;
			$this->modifiedColumns[] = HrLocationsPeer::MAINDISTRICTLOCATION;
		}

	} // setMaindistrictlocation()

	/**
	 * Hydrates (populates) the object variables with values from the database resultset.
	 *
	 * An offset (1-based "start column") is specified so that objects can be hydrated
	 * with a subset of the columns in the resultset rows.  This is needed, for example,
	 * for results of JOIN queries where the resultset row includes columns from two or
	 * more tables.
	 *
	 * @param      ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
	 * @param      int $startcol 1-based offset column which indicates which restultset column to start with.
	 * @return     int next starting column
	 * @throws     PropelException  - Any caught Exception will be rewrapped as a PropelException.
	 */
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->location_uid = $rs->getString($startcol + 0);

			$this->district_id = $rs->getString($startcol + 1);

			$this->locationstate_id = $rs->getString($startcol + 2);

			$this->locationname = $rs->getString($startcol + 3);

			$this->locationaddress1 = $rs->getString($startcol + 4);

			$this->locationaddress2 = $rs->getString($startcol + 5);

			$this->locationsite = $rs->getString($startcol + 6);

			$this->locationzipcode = $rs->getString($startcol + 7);

			$this->locationphone = $rs->getString($startcol + 8);

			$this->locationfax = $rs->getString($startcol + 9);

			$this->locationcode = $rs->getString($startcol + 10);

			$this->locationcomments = $rs->getString($startcol + 11);

			$this->irn = $rs->getString($startcol + 12);

			$this->maindistrictlocation = $rs->getInt($startcol + 13);

			$this->resetModified();

			$this->setNew(false);

			// FIXME - using NUM_COLUMNS may be clearer.
			return $startcol + 14; // 14 = HrLocationsPeer::NUM_COLUMNS - HrLocationsPeer::NUM_LAZY_LOAD_COLUMNS).

		} catch (Exception $e) {
			throw new PropelException("Error populating HrLocations object", $e);
		}
	}

	/**
	 * Removes this object from datastore and sets delete attribute.
	 *
	 * @param      Connection $con
	 * @return     void
	 * @throws     PropelException
	 * @see        BaseObject::setDeleted()
	 * @see        BaseObject::isDeleted()
	 */
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(HrLocationsPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			HrLocationsPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	/**
	 * Stores the object in the database.  If the object is new,
	 * it inserts it; otherwise an update is performed.  This method
	 * wraps the doSave() worker method in a transaction.
	 *
	 * @param      Connection $con
	 * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
	 * @throws     PropelException
	 * @see        doSave()
	 */
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(HrLocationsPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	/**
	 * Stores the object in the database.
	 *
	 * If the object is new, it inserts it; otherwise an update is performed.
	 * All related objects are also updated in this method.
	 *
	 * @param      Connection $con
	 * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
	 * @throws     PropelException
	 * @see        save()
	 */
	protected function doSave($con)
	{
		$affectedRows = 0; // initialize var to track total num of affected rows
		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


			// If this object has been modified, then save it to the database.
			if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = HrLocationsPeer::doInsert($this, $con);
					$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
										 // should always be true here (even though technically
										 // BasePeer::doInsert() can insert multiple rows).

					$this->setNew(false);
				} else {
					$affectedRows += HrLocationsPeer::doUpdate($this, $con);
				}
				$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} // doSave()

	/**
	 * Array of ValidationFailed objects.
	 * @var        array ValidationFailed[]
	 */
	protected $validationFailures = array();

	/**
	 * Gets any ValidationFailed objects that resulted from last call to validate().
	 *
	 *
	 * @return     array ValidationFailed[]
	 * @see        validate()
	 */
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	/**
	 * Validates the objects modified field values and all objects related to this table.
	 *
	 * If $columns is either a column name or an array of column names
	 * only those columns are validated.
	 *
	 * @param      mixed $columns Column name or an array of column names.
	 * @return     boolean Whether all columns pass validation.
	 * @see        doValidate()
	 * @see        getValidationFailures()
	 */
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	/**
	 * This function performs the validation work for complex object models.
	 *
	 * In addition to checking the current object, all related objects will
	 * also be validated.  If all pass then <code>true</code> is returned; otherwise
	 * an aggreagated array of ValidationFailed objects will be returned.
	 *
	 * @param      array $columns Array of column names to validate.
	 * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
	 */
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = HrLocationsPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}



			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	/**
	 * Retrieves a field from the object by name passed in as a string.
	 *
	 * @param      string $name name
	 * @param      string $type The type of fieldname the $name is of:
	 *                     one of the class type constants TYPE_PHPNAME,
	 *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return     mixed Value of field.
	 */
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = HrLocationsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	/**
	 * Retrieves a field from the object by Position as specified in the xml schema.
	 * Zero-based.
	 *
	 * @param      int $pos position in xml schema
	 * @return     mixed Value of field at $pos
	 */
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getLocationUid();
				break;
			case 1:
				return $this->getDistrictId();
				break;
			case 2:
				return $this->getLocationstateId();
				break;
			case 3:
				return $this->getLocationname();
				break;
			case 4:
				return $this->getLocationaddress1();
				break;
			case 5:
				return $this->getLocationaddress2();
				break;
			case 6:
				return $this->getLocationsite();
				break;
			case 7:
				return $this->getLocationzipcode();
				break;
			case 8:
				return $this->getLocationphone();
				break;
			case 9:
				return $this->getLocationfax();
				break;
			case 10:
				return $this->getLocationcode();
				break;
			case 11:
				return $this->getLocationcomments();
				break;
			case 12:
				return $this->getIrn();
				break;
			case 13:
				return $this->getMaindistrictlocation();
				break;
			default:
				return null;
				break;
		} // switch()
	}

	/**
	 * Exports the object as an array.
	 *
	 * You can specify the key type of the array by passing one of the class
	 * type constants.
	 *
	 * @param      string $keyType One of the class type constants TYPE_PHPNAME,
	 *                        TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return     an associative array containing the field names (as keys) and field values
	 */
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = HrLocationsPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getLocationUid(),
			$keys[1] => $this->getDistrictId(),
			$keys[2] => $this->getLocationstateId(),
			$keys[3] => $this->getLocationname(),
			$keys[4] => $this->getLocationaddress1(),
			$keys[5] => $this->getLocationaddress2(),
			$keys[6] => $this->getLocationsite(),
			$keys[7] => $this->getLocationzipcode(),
			$keys[8] => $this->getLocationphone(),
			$keys[9] => $this->getLocationfax(),
			$keys[10] => $this->getLocationcode(),
			$keys[11] => $this->getLocationcomments(),
			$keys[12] => $this->getIrn(),
			$keys[13] => $this->getMaindistrictlocation(),
		);
		return $result;
	}

	/**
	 * Sets a field from the object by name passed in as a string.
	 *
	 * @param      string $name peer name
	 * @param      mixed $value field value
	 * @param      string $type The type of fieldname the $name is of:
	 *                     one of the class type constants TYPE_PHPNAME,
	 *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return     void
	 */
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = HrLocationsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	/**
	 * Sets a field from the object by Position as specified in the xml schema.
	 * Zero-based.
	 *
	 * @param      int $pos position in xml schema
	 * @param      mixed $value field value
	 * @return     void
	 */
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setLocationUid($value);
				break;
			case 1:
				$this->setDistrictId($value);
				break;
			case 2:
				$this->setLocationstateId($value);
				break;
			case 3:
				$this->setLocationname($value);
				break;
			case 4:
				$this->setLocationaddress1($value);
				break;
			case 5:
				$this->setLocationaddress2($value);
				break;
			case 6:
				$this->setLocationsite($value);
				break;
			case 7:
				$this->setLocationzipcode($value);
				break;
			case 8:
				$this->setLocationphone($value);
				break;
			case 9:
				$this->setLocationfax($value);
				break;
			case 10:
				$this->setLocationcode($value);
				break;
			case 11:
				$this->setLocationcomments($value);
				break;
			case 12:
				$this->setIrn($value);
				break;
			case 13:
				$this->setMaindistrictlocation($value);
				break;
		} // switch()
	}

	/**
	 * Populates the object using an array.
	 *
	 * This is particularly useful when populating an object from one of the
	 * request arrays (e.g. $_POST).  This method goes through the column
	 * names, checking to see whether a matching key exists in populated
	 * array. If so the setByName() method is called for that column.
	 *
	 * You can specify the key type of the array by additionally passing one
	 * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
	 * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
	 *
	 * @param      array  $arr     An array to populate the object from.
	 * @param      string $keyType The type of keys the array uses.
	 * @return     void
	 */
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = HrLocationsPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setLocationUid($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setDistrictId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setLocationstateId($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setLocationname($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setLocationaddress1($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setLocationaddress2($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setLocationsite($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setLocationzipcode($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setLocationphone($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setLocationfax($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setLocationcode($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setLocationcomments($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setIrn($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setMaindistrictlocation($arr[$keys[13]]);
	}

	/**
	 * Build a Criteria object containing the values of all modified columns in this object.
	 *
	 * @return     Criteria The Criteria object containing all modified values.
	 */
	public function buildCriteria()
	{
		$criteria = new Criteria(HrLocationsPeer::DATABASE_NAME);

		if ($this->isColumnModified(HrLocationsPeer::LOCATION_UID)) $criteria->add(HrLocationsPeer::LOCATION_UID, $this->location_uid);
		if ($this->isColumnModified(HrLocationsPeer::DISTRICT_ID)) $criteria->add(HrLocationsPeer::DISTRICT_ID, $this->district_id);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONSTATE_ID)) $criteria->add(HrLocationsPeer::LOCATIONSTATE_ID, $this->locationstate_id);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONNAME)) $criteria->add(HrLocationsPeer::LOCATIONNAME, $this->locationname);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONADDRESS1)) $criteria->add(HrLocationsPeer::LOCATIONADDRESS1, $this->locationaddress1);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONADDRESS2)) $criteria->add(HrLocationsPeer::LOCATIONADDRESS2, $this->locationaddress2);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONSITE)) $criteria->add(HrLocationsPeer::LOCATIONSITE, $this->locationsite);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONZIPCODE)) $criteria->add(HrLocationsPeer::LOCATIONZIPCODE, $this->locationzipcode);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONPHONE)) $criteria->add(HrLocationsPeer::LOCATIONPHONE, $this->locationphone);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONFAX)) $criteria->add(HrLocationsPeer::LOCATIONFAX, $this->locationfax);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONCODE)) $criteria->add(HrLocationsPeer::LOCATIONCODE, $this->locationcode);
		if ($this->isColumnModified(HrLocationsPeer::LOCATIONCOMMENTS)) $criteria->add(HrLocationsPeer::LOCATIONCOMMENTS, $this->locationcomments);
		if ($this->isColumnModified(HrLocationsPeer::IRN)) $criteria->add(HrLocationsPeer::IRN, $this->irn);
		if ($this->isColumnModified(HrLocationsPeer::MAINDISTRICTLOCATION)) $criteria->add(HrLocationsPeer::MAINDISTRICTLOCATION, $this->maindistrictlocation);

		return $criteria;
	}

	/**
	 * Builds a Criteria object containing the primary key for this object.
	 *
	 * Unlike buildCriteria() this method includes the primary key values regardless
	 * of whether or not they have been modified.
	 *
	 * @return     Criteria The Criteria object containing value(s) for primary key(s).
	 */
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(HrLocationsPeer::DATABASE_NAME);

		$criteria->add(HrLocationsPeer::LOCATION_UID, $this->location_uid);

		return $criteria;
	}

	/**
	 * Returns the primary key for this object (row).
	 * @return     string
	 */
	public function getPrimaryKey()
	{
		return $this->getLocationUid();
	}

	/**
	 * Generic method to set the primary key (location_uid column).
	 *
	 * @param      string $key Primary key.
	 * @return     void
	 */
	public function setPrimaryKey($key)
	{
		$this->setLocationUid($key);
	}

	/**
	 * Sets contents of passed object to values from current object.
	 *
	 * If desired, this method can also make copies of all associated (fkey referrers)
	 * objects.
	 *
	 * @param      object $copyObj An object of HrLocations (or compatible) type.
	 * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
	 * @throws     PropelException
	 */
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setDistrictId($this->district_id);

		$copyObj->setLocationstateId($this->locationstate_id);

		$copyObj->setLocationname($this->locationname);

		$copyObj->setLocationaddress1($this->locationaddress1);

		$copyObj->setLocationaddress2($this->locationaddress2);

		$copyObj->setLocationsite($this->locationsite);

		$copyObj->setLocationzipcode($this->locationzipcode);

		$copyObj->setLocationphone($this->locationphone);

		$copyObj->setLocationfax($this->locationfax);

		$copyObj->setLocationcode($this->locationcode);

		$copyObj->setLocationcomments($this->locationcomments);

		$copyObj->setIrn($this->irn);

		$copyObj->setMaindistrictlocation($this->maindistrictlocation);


		$copyObj->setNew(true);

		$copyObj->setLocationUid(''); // this is a pkey column, so set to default value

	}

	/**
	 * Makes a copy of this object that will be inserted as a new row in table when saved.
	 * It creates a new object filling in the simple attributes, but skipping any primary
	 * keys that are defined for the table.
	 *
	 * If desired, this method can also make copies of all associated (fkey referrers)
	 * objects.
	 *
	 * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
	 * @return     HrLocations Clone of current object.
	 * @throws     PropelException
	 */
	public function copy($deepCopy = false)
	{
		// we use get_class(), because this might be a subclass
		$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	/**
	 * Returns a peer instance associated with this om.
	 *
	 * Since Peer classes are not to have any instance attributes, this method returns the
	 * same instance for all member of this class. The method could therefore
	 * be static, but this would prevent one from overriding the behavior.
	 *
	 * @return     HrLocationsPeer
	 */
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new HrLocationsPeer();
		}
		return self::$peer;
	}

} // BaseHrLocations
